import 'package:base_network/export.dart';

class CommonApiService {
  static Future<String> _request(Future<Response> future) async{
    Response response = await future;
    String dataString = response.data.toString();
    return dataString;
  }

  static Future<String> requestGet({
    required String url,
    dynamic data,
  }) {
    return _request(DioCreator.getDio().get(url, queryParameters: data));
  }

  static Future<String> requestPost({
    required String url,
    dynamic data,
  }) {
    return _request(DioCreator.getDio().post(url, queryParameters: data));
  }

  static Future<String> requestDelete({
    required String url,
    dynamic data,
  }) {
    return _request(DioCreator.getDio().delete(url, data: data));
  }

  static Future<String> requestPut({
    required String url,
    dynamic data,
  }) {
    return _request(DioCreator.getDio().put(url, data: data));
  }
}
